package com.cfuture08.home.action.perm;

import java.util.List;

import com.cfuture08.eweb4j.component.DivPageComp;
import com.cfuture08.eweb4j.component.dwz.ListTemp;
import com.cfuture08.eweb4j.mvc.action.Action;
import com.cfuture08.eweb4j.mvc.action.ActionSupport;
import com.cfuture08.eweb4j.orm.dao.DAO;
import com.cfuture08.home.vo.Perm;

public class ShowAllPerm extends ActionSupport {
	private int pageNum = 1;
	private int numPerPage = 20;

	public String execute() {
		// 分页查询
		List<Perm> permList = DAO.divPage(Perm.class, pageNum, numPerPage);
		// 将模板数据传入页面
		request.setAttribute("listTemp", new ListTemp("addPerm.jsp",
				"deletePerm.do", "showPerm.do", "showAllPerm.do", permList));
		// 分页组件
		request.setAttribute("dpc", new DivPageComp(pageNum, numPerPage, DAO
				.selectCount(Perm.class), 10, null, null));

		return Action.SUCCESS;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getNumPerPage() {
		return numPerPage;
	}

	public void setNumPerPage(int numPerPage) {
		this.numPerPage = numPerPage;
	}
}
